package com.controller;

import com.entity.City;
import com.entity.Company;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.ArrayList;

@Controller
@RequestMapping(value="/city")
public class CityController {
    //访问城市吞吐量jsp页面路径
    @RequestMapping(value = "/cityFlightThroughput")
    public String getCityThroughput(){
        return "cityFlightThroughput";
    }

    //城市吞吐量jsp页面加载数据
    @RequestMapping("/loadCityFlightThroughput")
    @ResponseBody
    public ArrayList<City> loadCityFlightThroughput() {
        ArrayList<City> cityArrayList = new ArrayList<>();
        City city1 = new City("北京",12000);
        City city2 = new City("上海",9800);
        City city3 = new City("深圳",30000);
        City city4 = new City("广州",8050);
        City city5 = new City("哈尔滨",120);
        City city6 = new City("长春",500);
        City city7 = new City("沈阳",50);
        City city8 = new City("青岛",100);
        City city9 = new City("石家庄",1000);
        City city10 = new City("天津",580);
        City city11 = new City("南京",1500);
        City city12 = new City("合肥",30);
        City city13 = new City("湛江",240);
        City city14 = new City("海口",3400);
        City city15 = new City("台北",34000);
        City city16 = new City("贵阳",230);
        City city17 = new City("广西",686);
        City city18 = new City("成都",3888);
        City city19 = new City("乌鲁木齐",789);
        City city20 = new City("西安",159);
        cityArrayList.add(city1);
        cityArrayList.add(city2);
        cityArrayList.add(city3);
        cityArrayList.add(city4);
        cityArrayList.add(city5);
        cityArrayList.add(city6);
        cityArrayList.add(city7);
        cityArrayList.add(city8);
        cityArrayList.add(city9);
        cityArrayList.add(city10);
        cityArrayList.add(city11);
        cityArrayList.add(city12);
        cityArrayList.add(city13);
        cityArrayList.add(city14);
        cityArrayList.add(city15);
        cityArrayList.add(city16);
        cityArrayList.add(city17);
        cityArrayList.add(city18);
        cityArrayList.add(city19);
        cityArrayList.add(city20);
        return cityArrayList;
    }
}
